const UploadUrl = import.meta.env.VITE_UPLOAD_URL;

export const uploadFiles = (data: UploadParams) => {
  return new Promise<any>((resolve, reject) => {
    uni.uploadFile({
      url: UploadUrl + '/common/upload/files',
      filePath: data.filePath,
      name: data.name,
      formData: {},
      success(e) {
        resolve(JSON.parse(e.data));
      },
      fail(err) {
        console.log('err: ', err);
        reject(err as any);
      },
    });
  });
};
